package com.w2cx.selenium.util;

import org.testng.IAnnotationTransformer;
import org.testng.IRetryAnalyzer;
import org.testng.annotations.ITestAnnotation;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

//失败重跑监听
public class RetryListener implements IAnnotationTransformer {
    @Override
    public void transform(ITestAnnotation iTestAnnotation, Class aClass, Constructor constructor, Method method) {


        IRetryAnalyzer retry = iTestAnnotation.getRetryAnalyzer();
        if(retry == null){
            iTestAnnotation.setRetryAnalyzer(Retry.class);
        }

    }
}
